#!/bin/bash
if test -z "$1"
then 
  echo 'Use: getItem.sh <year>'
  exit 1
fi
year=$1
for type in DISTRICT SCHOOL
do
  dir=item$type
  if test ! -d $dir
  then mkdir $dir
  fi
  for grade in 03 04 05 06 07 08 10 HS
  do 
    for subject in ELA MTH HIS SCI BIO CHE PHY TEC
    do echo grade $grade $subject
      curl http://profiles.doe.mass.edu/state_report/mcas_item.aspx?\&export_excel=yes\&year=$year\&reportType=$type\&subject=$subject\&grade=$grade > $dir/$year$grade$subject.html
      sleep 1
    done
  done
done
